package wiki.zimo.domain;


import wiki.zimo.annotation.Column;
import wiki.zimo.annotation.ID;
import wiki.zimo.annotation.Table;

import java.util.Objects;

/**
 * @auther: 子墨
 * @datetime: 2018/11/7 12:37
 * @describe: 用户实体类
 */
@Table(value = "user")
public class User {
    @ID(value = "uid")
    private String uid;

    @Column(value = "username")
    private String username;

    @Column(value = "password")
    private String password;

    @Column(value = "name")
    private String name;

    @Column(value = "email")
    private String email;

    @Column(value = "telephone")
    private String telephone;

    @Column(value = "birthday")
    private String birthday;

    @Column(value = "sex")
    private String sex;

    @Column(value = "state")
    private long state;

    @Column(value = "code")
    private String code;

    @Column(value = "isadmin")
    private int isadmin;

    private int orderCount;

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public long getState() {
        return state;
    }

    public void setState(long state) {
        this.state = state;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public int getIsadmin() {
        return isadmin;
    }

    public void setIsadmin(int isadmin) {
        this.isadmin = isadmin;
    }

    public int getOrderCount() {
        return orderCount;
    }

    public void setOrderCount(int orderCount) {
        this.orderCount = orderCount;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return state == user.state &&
                isadmin == user.isadmin &&
                orderCount == user.orderCount &&
                Objects.equals(uid, user.uid) &&
                Objects.equals(username, user.username) &&
                Objects.equals(password, user.password) &&
                Objects.equals(name, user.name) &&
                Objects.equals(email, user.email) &&
                Objects.equals(telephone, user.telephone) &&
                Objects.equals(birthday, user.birthday) &&
                Objects.equals(sex, user.sex) &&
                Objects.equals(code, user.code);
    }

    @Override
    public int hashCode() {

        return Objects.hash(uid, username, password, name, email, telephone, birthday, sex, state, code, isadmin, orderCount);
    }

    @Override
    public String toString() {
        return "User{" +
                "uid='" + uid + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", name='" + name + '\'' +
                ", email='" + email + '\'' +
                ", telephone='" + telephone + '\'' +
                ", birthday='" + birthday + '\'' +
                ", sex='" + sex + '\'' +
                ", state=" + state +
                ", code='" + code + '\'' +
                ", isadmin=" + isadmin +
                ", orderCount=" + orderCount +
                '}';
    }
}
